/*
 * @Author: YinJianFeng 814922893@qq.com
 * @Date: 2025-01-22 15:39:47
 * @LastEditors: 殷建峰
 * @LastEditTime: 2025-02-05 19:13:51
 */
import { Button, Divider, Dropdown, MenuProps } from 'antd';
import styles from './styles.module.scss';
// import { CmdButton } from '../CmdButtons';
// import { cmdTopoModify } from '@/commands/topo/cmd-modify';
// import { DownOutlined } from '@ant-design/icons';
import { VscChevronDown } from 'react-icons/vsc';
import { ReactNode } from 'react';

export interface IProps {
  cmdLayout: ReactNode;
  footerLabel: string;
  footerItems?: MenuProps['items'];
}

export default function CmdGroup({
  cmdLayout,
  footerLabel,
  footerItems,
}: IProps) {
  return (
    <div className={styles.cmdGroup}>
      <div className={styles.group}>
        <div className='h-[58px] flex flex-col justify-center'>{cmdLayout}</div>
        {footerItems && footerItems.length > 0 ? (
          <Dropdown
            menu={{ items: footerItems }}
            trigger={['click']}>
            <Button
              className={styles.groupFooter}
              icon={<VscChevronDown />}
              iconPosition='end'>
              {footerLabel}
            </Button>
          </Dropdown>
        ) : (
          <Button className={styles.groupFooter}>{footerLabel}</Button>
        )}
      </div>
      <Divider type='vertical' />
    </div>
  );
}
